from google.appengine.ext import webapp
from models.Users import *
from models.Authentication import *
class Image(webapp.RequestHandler):
    def get(self):
        user = get_current_user(self.request)
       
        if user.avatar:
            self.response.headers['Content-Type'] = "image/png"
            self.response.out.write(user.avatar)
        else:
            self.redirect('/public/images/defaultuser.png')

class ProfileImage(webapp.RequestHandler):
    def get(self, userID):
        user = get_current_user(self.request)
        if user.avatar:
            self.response.headers['Content-Type'] = "image/png"
            self.response.out.write(user.avatar)
        else:
            self.redirect('/public/images/defaultuser.png')
